home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / ieee754 / huge_val.h < prev    next >
C/C++ Source or Header  |  1992-11-18  |  2KB  |  48 lines

  1. /* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
  2.    Used by <stdlib.h> and <math.h> functions for overflow.
  3.  
  4. Copyright (C) 1992 Free Software Foundation, Inc.
  5. This file is part of the GNU C Library.
  6.  
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Library General Public License as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version.
  11.  
  12. The GNU C Library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. Library General Public License for more details.
  16.  
  17. You should have received a copy of the GNU Library General Public
  18. License along with the GNU C Library; see the file COPYING.LIB.  If
  19. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  20. Cambridge, MA 02139, USA.  */
  21.  
  22. #ifndef       _HUGE_VAL_H
  23. #define       _HUGE_VAL_H    1
  24.  
  25. #include <sys/cdefs.h>
  26. #include <endian.h>
  27.  
  28. /* IEEE positive infinity.  */
  29.  
  30. #if __BYTE_ORDER == __BIG_ENDIAN
  31. #define    __huge_val_bytes    { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
  32. #endif
  33. #if __BYTE_ORDER == __LITTLE_ENDIAN
  34. #define    __huge_val_bytes    { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
  35. #endif
  36.  
  37. #ifdef    __GNUC__
  38. #define    HUGE_VAL \
  39.   (__extension__ ((union { unsigned char __c[8];                  \
  40.                double __d; })                      \
  41.           { __huge_val_bytes }).__d)
  42. #else    /* Not GCC.  */
  43. static __const char __huge_val[8] = __huge_val_bytes;
  44. #define    HUGE_VAL    (*(__const double *) __huge_val)
  45. #endif    /* GCC.  */
  46.  
  47. #endif       /* huge_val.h */
  48.